﻿using DocumentFormat.OpenXml.Lite.Shared;
using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.DrawingML.Transformation
{
    public class AdjustHandle : XmlSerializable
    {
        [XmlElement("", Namespace = Constants.Main)]
        public XmlList<IAdjustHandle> Handles { get; set; }

        public AdjustHandle()
        {
            Handles = new XmlList<IAdjustHandle>();
        }
    }

    [XmlRoot("ahXY", Namespace = Constants.Main)]
    public class XYAdjustHandle : SimpleAdjustHandle, IAdjustHandle
    {
        public XYAdjustHandle() { }
    }

    [XmlRoot("ahPolar", Namespace = Constants.Main)]
    public class PolarAdjustHandle : SimpleAdjustHandle, IAdjustHandle
    {
        public PolarAdjustHandle() { }
    }

    public class SimpleAdjustHandle : XmlSerializable
    {
        [Optional]
        [XmlAttribute("gdRefX", Form = XmlSchemaForm.Qualified)]
        public string HorizontalAdjustmentGuide { get; set; }

        [Optional]
        [XmlAttribute("minX", Form = XmlSchemaForm.Qualified)]
        public string MinimalHorizontalAdjustment { get; set; }

        [Optional]
        [XmlAttribute("maxX", Form = XmlSchemaForm.Qualified)]
        public string MaximalHorizontalAdjustment { get; set; }

        [Optional]
        [XmlAttribute("gdRefY", Form = XmlSchemaForm.Qualified)]
        public string VerticalAdjustmentGuide { get; set; }

        [Optional]
        [XmlAttribute("minY", Form = XmlSchemaForm.Qualified)]
        public string MinimalVerticalAdjustment { get; set; }

        [Optional]
        [XmlAttribute("maxY", Form = XmlSchemaForm.Qualified)]
        public string MaximalVerticalAdjustment { get; set; }

        [XmlElement("pos", Namespace = Constants.Main)]
        public Position Position { get; set; }

        public SimpleAdjustHandle() { }
    }

    [XmlRoot("pos", Namespace = Constants.Main)]
    public class Position : XmlSerializable
    {
        [XmlAttribute("X", Form = XmlSchemaForm.Qualified)]
        public string XCoordinate { get; set; }

        [XmlAttribute("Y", Form = XmlSchemaForm.Qualified)]
        public string YCoordinate { get; set; }

        public Position() { }
    }
}
